package net.qiqb.ddd.user.domain;

import lombok.Getter;
import net.qiqb.core.domain.annotation.AggregateRoot;
import net.qiqb.core.domain.annotation.BusinessId;
import net.qiqb.core.domain.annotation.ExpandableAggregateRoot;
import net.qiqb.execute.UserId;

@AggregateRoot
public class UserAggregateRoot extends ExpandableAggregateRoot<UserId> {


    @BusinessId
    private String account;

    private String mobile;

    @Getter
    private String userName;

    public UserAggregateRoot(UserId id, String userName) {
        super(id);
        this.userName = userName;
    }

    public void changeName(String name) {
        this.userName = name;
    }



    @Override
    public String toString() {
        return "UserEntity{" +
                "id=" + getId() +
                ", userName='" + userName + '\'' +
                '}';
    }
}
